﻿<UserControl
   xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:basics="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls" 
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" 
  xmlns:controls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls"
  xmlns:common="clr-namespace:System.Windows;assembly=System.Windows.Controls" 
  xmlns:controlsToolkit="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Toolkit"
             
             xmlns:local="clr-namespace:FileManager"
   xmlns:ic="clr-namespace:Microsoft.Expression.Interactivity.Core;assembly=Microsoft.Expression.Interactions"
   x:Class="FileManager.MainPage_OOB" 
    Width="600" Height="400"  >
    <UserControl.Resources>
        <Style x:Key="GridSplitterCustomStyle" TargetType="controls:GridSplitter">
            <Setter Property="Background" Value="#FFFFFFFF"/>
            <Setter Property="IsTabStop" Value="true"/>
            <Setter Property="HorizontalAlignment" Value="Right"/>
            <Setter Property="PreviewStyle">
                <Setter.Value>
                    <Style TargetType="Control">
                        <Setter Property="Background" Value="#FF868686"/>
                        <Setter Property="Template">
                            <Setter.Value>
                                <ControlTemplate TargetType="Control">
                                    <Grid x:Name="Root" Opacity=".5">
                                        <Rectangle Fill="{TemplateBinding Background}"/>
                                        <Grid x:Name="HorizontalTemplate" Height="6"/>
                                        <Grid x:Name="VerticalTemplate" Width="6" Visibility="Collapsed"/>
                                    </Grid>
                                </ControlTemplate>
                            </Setter.Value>
                        </Setter>
                    </Style>
                </Setter.Value>
            </Setter>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="controls:GridSplitter">
                        <Grid x:Name="Root" IsHitTestVisible="{TemplateBinding IsEnabled}" Margin="-2,6,-4,6">
                            <VisualStateManager.VisualStateGroups>
                                <VisualStateGroup x:Name="CommonStates">
                                    <VisualState x:Name="Normal"/>
                                    <VisualState x:Name="MouseOver"/>
                                    <VisualState x:Name="Disabled">
                                        <Storyboard>
                                            <DoubleAnimation Duration="0" Storyboard.TargetName="Root" Storyboard.TargetProperty="Opacity" To="0.5"/>
                                        </Storyboard>
                                    </VisualState>
                                </VisualStateGroup>
                                <VisualStateGroup x:Name="FocusStates">
                                    <VisualStateGroup.Transitions>
                                        <VisualTransition GeneratedDuration="0"/>
                                    </VisualStateGroup.Transitions>
                                    <VisualState x:Name="Unfocused"/>
                                    <VisualState x:Name="Focused">
                                        <Storyboard>
                                            <DoubleAnimation Duration="0" Storyboard.TargetName="FocusVisual" Storyboard.TargetProperty="Opacity" To="1"/>
                                        </Storyboard>
                                    </VisualState>
                                </VisualStateGroup>
                            </VisualStateManager.VisualStateGroups>
                            <Rectangle Fill="{TemplateBinding Background}" StrokeThickness="0" Opacity="0"/>
                            <Grid x:Name="HorizontalTemplate" Height="10">
                                <StackPanel Height="6" VerticalAlignment="Center">
                                    <Rectangle Fill="#FF868686" StrokeThickness="0" Height="1" Margin="1" Width="10"/>
                                    <Rectangle Fill="#FF868686" StrokeThickness="0" Height="1" Margin="1" Width="10"/>
                                </StackPanel>
                            </Grid>
                            <Grid x:Name="VerticalTemplate" Width="10" Visibility="Collapsed">
                                <StackPanel VerticalAlignment="Center" Width="6" Orientation="Horizontal">
                                    <Rectangle Fill="#FF868686" StrokeThickness="0" Height="41" Margin="1" Width="6"/>
                                    <Rectangle Fill="#FF868686" StrokeThickness="0" Height="10" Margin="1" Width="0"/>
                                </StackPanel>
                            </Grid>
                            <Rectangle x:Name="FocusVisual" StrokeThickness="0" IsHitTestVisible="false" Opacity="0"/>
                        </Grid>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
    </UserControl.Resources>
    <Canvas x:Name="LayoutRoot">
        <Grid x:Name="FileManager" Background="White" Height="400" Width="600">
            <Grid.Resources>
                <Style x:Key="SelectedItemStyle" TargetType="controls:TreeViewItem">
                    <Setter Property="IsExpanded" Value="True" />
                    <Setter Property="IsSelected" Value="True" />
                </Style>
                <Style x:Key="ExpandedItemStyle" TargetType="controls:TreeViewItem">
                    <Setter Property="IsExpanded" Value="True" />
                </Style>
            </Grid.Resources>
            <Grid.RowDefinitions>
                <RowDefinition Height="0.068*"/>
                <RowDefinition Height="0.932*"/>
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*"/>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>
            <ScrollViewer Grid.Row="1" Grid.Column="0" x:Name="FileFolders" Margin="5,5,5,5"/>
            <ScrollViewer Grid.Row="1" Grid.Column="1" x:Name="FileDetails" Margin="2,5,5,5">
               <local:FileList_OOB x:Name="FileDetailList"  />
               
            </ScrollViewer>
            
            <controls:GridSplitter Width="2" Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="1" Background="#FFC4BFBF" Margin="0,0,0,0" Style="{StaticResource GridSplitterCustomStyle}"/>
            <controls:TreeView SelectedItemChanged="FolderTree_SelectedItemChanged" Grid.Row="1" Grid.Column="0" Margin="5,5,3,5" x:Name="FolderTree" ItemContainerStyle="{StaticResource SelectedItemStyle}" d:LayoutOverrides="GridBox">
                <controls:TreeView.ItemTemplate>
                    <common:HierarchicalDataTemplate ItemsSource="{Binding SubFolders}" ItemContainerStyle="{StaticResource ExpandedItemStyle}">
                        <StackPanel x:Name="TreeFolder" Orientation="Horizontal" Tag="{Binding FolderID}">
                            <VisualStateManager.CustomVisualStateManager>
                                <ic:ExtendedVisualStateManager/>
                            </VisualStateManager.CustomVisualStateManager>
                            <VisualStateManager.VisualStateGroups>
                                <VisualStateGroup x:Name="TreeViewDragOver"/>
                            </VisualStateManager.VisualStateGroups>
                            <Image HorizontalAlignment="Left" Margin="1,0,0,0" Width="16" Source="images/folder.png" Stretch="Fill"/>
                            <TextBlock Text="{Binding FolderName}" Margin="5,0" />
                        </StackPanel>
                    </common:HierarchicalDataTemplate>
                </controls:TreeView.ItemTemplate>
            </controls:TreeView>
            <StackPanel Margin="5,0,5,0" Grid.Column="0" Orientation="Horizontal" Grid.ColumnSpan="3" HorizontalAlignment="Right" Name="pnlEditOptions">
                <Button x:Name="EditFolder" Height="20" ToolTipService.ToolTip="Edit a Folder" Margin="2,0,2,0" HorizontalAlignment="Left" Click="EditFolder_Click" >
                    <Image Height="16" Width="16" Source="images/folder_edit.png" Stretch="Fill"/>
                </Button>
                <Button x:Name="AddFolder" Height="20" ToolTipService.ToolTip="Add a Folder" Margin="2,0,2,0" HorizontalAlignment="Left" Click="AddFolder_Click" >
                    <Image HorizontalAlignment="Left" Margin="1,0,1,0" Width="16" Source="images/folder_add.png" Stretch="Fill"/>
                </Button>
                <Button x:Name="DeleteFolder" Height="20" ToolTipService.ToolTip="Delete a Folder" Click="DeleteFolder_Click"  Margin="2,0,2,0" HorizontalAlignment="Left">
                    <Image HorizontalAlignment="Left" Margin="1,0,1,0" Width="16" Source="images/folder_delete.png" Stretch="Fill"/>
                </Button>
                <Rectangle x:Name="separator" Fill="White" Stroke="#FFCBC8C8" Margin="2,4,2,3" Width="1"/>
                <Button x:Name="AddFile" Height="20" ToolTipService.ToolTip="Upload Files" Margin="2,0,2,0" HorizontalAlignment="Left" Click="AddFile_Click" Visibility="Visible">
                    <Image HorizontalAlignment="Left" Margin="1,0,1,0" Width="16" Source="images/page_add.png" Stretch="Fill"/>
                </Button>
                <Button x:Name="DeleteFile" Height="20" ToolTipService.ToolTip="Delete a File" Margin="2,0,2,0" HorizontalAlignment="Left" Click="DeleteFile_Click">
                    <Image HorizontalAlignment="Left" Margin="1,0,1,0" Width="16" Source="images/page_delete.png" Stretch="Fill"/>
                </Button>
            </StackPanel>
        </Grid>
        <local:WaitingIcon x:Name="waitingIcon" Width="87" Height="85" Canvas.Left="248" Canvas.Top="142"  >
            <local:WaitingIcon.Background>
                <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                    <GradientStop Color="#FF070B9C" Offset="0.57599997520446777"/>
                    <GradientStop Color="#FFFFFFFF" Offset="1"/>
                </LinearGradientBrush>
            </local:WaitingIcon.Background>
        </local:WaitingIcon>
    </Canvas>
</UserControl>